/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.bayu.services.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Bayu
 */
@Entity
@Table(name = "t_incoming_usage")
@NamedQueries({@NamedQuery(name = "TIncomingUsage.findAll", query = "SELECT t FROM TIncomingUsage t"), @NamedQuery(name = "TIncomingUsage.findById", query = "SELECT t FROM TIncomingUsage t WHERE t.id = :id"), @NamedQuery(name = "TIncomingUsage.findByTanggal", query = "SELECT t FROM TIncomingUsage t WHERE t.tanggal = :tanggal"), @NamedQuery(name = "TIncomingUsage.findByPlanIncoming", query = "SELECT t FROM TIncomingUsage t WHERE t.planIncoming = :planIncoming"), @NamedQuery(name = "TIncomingUsage.findByIncoming", query = "SELECT t FROM TIncomingUsage t WHERE t.incoming = :incoming"), @NamedQuery(name = "TIncomingUsage.findByPlanUsage", query = "SELECT t FROM TIncomingUsage t WHERE t.planUsage = :planUsage"), @NamedQuery(name = "TIncomingUsage.findByUsageData", query = "SELECT t FROM TIncomingUsage t WHERE t.usageData = :usageData")})
public class TIncomingUsage implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic()
    @Column(name = "tanggal")
    @Temporal(TemporalType.DATE)
    private Date tanggal;
    @Basic(optional = false)
    @Column(name = "plan_incoming")
    private double planIncoming;
    @Basic(optional = false)
    @Column(name = "incoming")
    private double incoming;
    @Basic(optional = false)
    @Column(name = "plan_usage")
    private double planUsage;
    @Basic(optional = false)
    @Column(name = "usage_data")
    private double usageData;
    @ManyToOne(cascade=CascadeType.ALL)
    @JoinColumn(name = "id_stock")
    private TStock idStock;
    

    public TIncomingUsage() {
    }

    public TIncomingUsage(Integer id) {
        this.id = id;
    }

    public TIncomingUsage(Integer id, Date tanggal, double planIncoming, double incoming, double planUsage, double usageData) {
        this.id = id;
        this.tanggal = tanggal;
        this.planIncoming = planIncoming;
        this.incoming = incoming;
        this.planUsage = planUsage;
        this.usageData = usageData;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getTanggal() {
        return tanggal;
    }

    public void setTanggal(Date tanggal) {
        this.tanggal = tanggal;
    }

    public double getPlanIncoming() {
        return planIncoming;
    }

    public void setPlanIncoming(double planIncoming) {
        this.planIncoming = planIncoming;
    }

    public double getIncoming() {
        return incoming;
    }

    public void setIncoming(double incoming) {
        this.incoming = incoming;
    }

    public double getPlanUsage() {
        return planUsage;
    }

    public void setPlanUsage(double planUsage) {
        this.planUsage = planUsage;
    }

    public double getUsageData() {
        return usageData;
    }

    public void setUsageData(double usageData) {
        this.usageData = usageData;
    }

    public TStock getIdStock() {
        return idStock;
    }

    public void setIdStock(TStock idStock) {
        this.idStock = idStock;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TIncomingUsage)) {
            return false;
        }
        TIncomingUsage other = (TIncomingUsage) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bayu.services.entity.TIncomingUsage[id=" + id + "]";
    }

}
